home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
016a
/
love4th.zip
/
CPU80X86.DOC
< prev
next >
Wrap
Text File
|
1991-10-01
|
2KB
|
48 lines
8086/8 Register Usage
=====================
The register usage is summarised as follows:
SI - Forth interpretive pointer (IP)
SP - Parameter stack } sometimes these pointers are
BP - Return stack } exchanged
CS - Points to code segment CS:
DS - Points to thread segment TS:
SS - Points to stack segment SS:
ES - Points to variable segment VS:
DI - reserved for use as local variable stack pointer
On entry to a word:
BX - points to the compilation address of the word being
executed
AX - is destroyed between words
CX, DX - may be used as scratch registers
Kernel examples of register usage
=================================
CODE LIT ( -- N )
WORD LODS AX PUSH NEXT-JMP C;
( LODS always loads relative to DS = TS: )
( PUSH stores relative to SS )
( all code executes relative to CS )
CODE @
BX POP ES: [BX] PUSH NEXT-JMP C;
( POP always loads relative to SS )
( [BX] must be overridden to fetch from ES: )
( PUSH always relative to SS)
CODE FILL ( addr, count, value -- )
DX, DI MOV ( save value of DI )
AX POP CX POP DI POP ( get parameters)
AH, AL MOV CX, 1 SHR ( odd number of bytes ?)
IFU< BYTE STOS ( odd # bytes ) THEN ( store odd one)
REP WORD STOS ( store the remainder)
DI, DX MOV NEXT-JMP C; ( restore DI)
( POP always loads relative to SS )
( STOS always stores relative to ES = VS: )